package Model;

import java.util.ArrayList;


public class TestTerrainGenerator
{
	public static void main(String args[])
	{
		Board b = new Board(150, 50);
		double[] bounds = Parameter.getResourcesParametersForNormalMap();
		//double[] bounds = Parameter.getResourcesParametersForPlainMap();
		//double[] bounds = Parameter.getResourcesParametersForAquaticMap();
		b.initGameBoard(10, 5, 0.2, bounds);
		System.out.println("Board without anyone :");
		b.displayBoardInTerminal();
		
		// Placement of humans
		Location QG = new Location(70,20);
		Clan clan = new Clan();
		for ( int i = 0 ; i < 100 ; i++ )
		{
			Location freeLocation = b.getFreeLocation(QG);
			Villager villager = new Villager(0, 0, freeLocation, 2, Activity.Hunter, clan);
			b.getSquareFromLocation(freeLocation).setBeingReference(villager);
		}
		System.out.println("\n\n\nBoard with the clan ! :");
		b.displayBoardInTerminal();
		System.out.println("\n\n\n");
		
		//Test for the path
		Location position = new Location(100,40);
		ArrayList<Location> path = b.getPath(position, QG);
		System.out.println(path.size());
		
		String[][] test = new String[150][50];
		for ( int i = 0 ; i < 150 ; i++ )
			for ( int j = 0 ; j < 50 ; j++ )
				test[i][j] = ".";

		test[position.getXPosition()][position.getYPosition()] = "D";
		test[QG.getXPosition()][QG.getYPosition()] = "F";
		
		for ( int i = 0 ; i < path.size() ; i++ )
		{
			System.out.println("(" + path.get(i).getXPosition() + "," + path.get(i).getYPosition() + ")");
			test[path.get(i).getXPosition()][path.get(i).getYPosition()] = "0";
		}
		
		for ( int j = 0 ; j < 50 ; j++ )
		{
			for ( int i = 0 ; i < 150 ; i++ )
				System.out.print(test[i][j]);
			System.out.println();
		}
	}
}
